﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.Scheme.DefaultModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	方案管理
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div>
    <%Html.BeginForm(); %>
        <table class="table" width='100%'>
            <tr class="th">
                <th colspan="4" align="left">搜索条件</th>
            </tr>
            <tr>
                <td ><%=Html.LabelFor(p=>p.where.LotteryID) %><%=Html.DropDownListFor(p=>p.where.LotteryID,Model.LotteryIDs,"所有彩种") %></td>
                <td ><%=Html.LabelFor(p=>p.where.WinModelID) %><%=Html.DropDownListFor(p=>p.where.WinModelID,Model.WinModels,"所有模式") %></td>
                <td><%=Html.LabelFor(p=>p.where.ConsumptionRatio) %><%=Html.DropDownListFor(p=>p.where.ConsumptionRatio,Model.ConsumptionRatios,"所有模式") %></td>
                <td ><input type="submit" value="查找" /></td>
            </tr>
        </table>
    <%Html.EndForm(); %>
</div>
<p></p>
<div class='Scheme_Index_MainDiv'>
    <table class="table" width='100%'>
        <tr class="th">
            <th>彩种</th><th>期号</th><th>方案金额</th><th>总注数</th><th>倍数</th><th>奖金模式</th><th>元角模式</th><th>添加时间</th><th>追号</th><th>状态</th><th>操作</th>
        </tr>
        <%var i = 0; foreach (var item in Model.SchemeDetail)
           {
               %>
                <tr <%=i++%2==1?"class='supersede'":"" %> id='tr_<%=i %>'>
                    <td><%=item.LotteryName%></td>
                    <td><%=item.IssueNumber%></td>
                    <td style=" text-align:right;"><%=item.SchemeMoney.ToString("C")%></td>
                    <td><%=item.SchemeCount%></td>
                    <td><%=item.SchemeMultiple%></td>
                    <td><%=item.WinModelName %></td>
                    <td><%=item.ConsumptionRatioName %></td>
                    <td><%=item.AddTime %></td>
                    <td><%=item.IsChaseTask?"是":"否" %></td>
                    <td class="State"><%=((SchemeState)item.SchemeState)==SchemeState.Normal?"尚未出票":((SchemeState)item.SchemeState).GetName()%></td>
                    <td>
                        <%=Html.ActionLink("查看号码", "Detail", Url.Route(new { Model.where, item.SchemeID, SI_Pg = Model.pageInfo.CurrPage }), Url.Route(new {@class="a_blue" }))%>&nbsp;
                        <% if (!item.IsEnd && ((SchemeState)item.SchemeState) == SchemeState.Normal)
                           {
                               %>
                                <label class="a_blue" style=" cursor:pointer;" onclick="QuashOrder('<%=Url.Action("QuashOrder",new {ID=item.SchemeID}) %>',<%=i %>,this)">撤单</label>
                               <%
                           } %>
                    </td>
                </tr>
               <%
            }
            var page = Model.pageInfo;
            if (page != null)
            {
           %>
                <tr>
                <td colspan='12'>
                    <%=Html.Pager(page.CurrPage, page.PageCount, page.SunCount,"pageInfo.CurrPage", Url.Route(new {Model.where}))%>
                </td>
                </tr>
           <%} %>
    </table>
</div>
</asp:Content>
<asp:Content ContentPlaceHolderID="StyleAndScript" runat="server">
    <script src='<%=Url.Content("~/Scripts/Play/play.js") %>' type="text/javascript"></script>
    <script type="text/javascript">
        function QuashOrder(url, index, obj) {
            if (confirm('您确定要撤消当前方案？')) {
                var tr = $('.Scheme_Index_MainDiv #tr_' + index);
                var td = tr.find('.State');
                Site.getJSON(url, null, function (successData) {
                    if (successData.result > 0) {
                        td.text('用户撤消');
                        obj.style.display = 'none';
                    }
                    alert(successData.msg);
                    if (successData.count > 0)
                        location.href = location.href;
                });
            }
        }
    </script>
</asp:Content>
